<?php

namespace App\Http\Middleware;

use Closure;
use App\Models\User;

class PatchWechat {
    public function handle($request, Closure $next) {
        try{
            $app = app('wechat');
            $user = $app->oauth->user();
            $openid = $user->id;
            session(['wechat_openid' => $openid]);
        }catch(\Overtrue\Socialite\AuthorizeFailedException $e){

        }
        return $next($request);
    }
}
